#include <bits/stdc++.h>
#define int long long
#define pii pair<int,int>
#define rg register
#define pc putchar
#define gc getchar
#define pf printf
#define space pc(' ')
#define enter pc('\n')
#define me(x,y) memset(x,y,sizeof(x))
#define pb push_back
#define FOR(i,k,t,p) for(rg int i(k) ; i <= t ; i += p)
#define ROF(i,k,t,p) for(rg int i(k) ; i >= t ; i -= p)
using namespace std ;
bool s_gnd ;
namespace superio{
    #define getchar my_getchar
    #define putchar my_putchar
    #define puts my_puts
    const int Isize = 1<<22,Osize = 1<<20;
    char ibuf[Isize],obuf[Osize];
    char *p1=ibuf,*p2=ibuf;
    int otop;
    class Oclear{
        public:
            inline void clear() {fwrite(obuf,sizeof(char),otop,stdout);otop=0;}
            ~Oclear() {clear();}
    }oclear;
    inline char getchar() {return p1==p2&&(p2=(p1=ibuf)+fread(ibuf,sizeof(char),sizeof(ibuf),stdin),p1==p2)?EOF:*p1++;}
    inline void putchar(const char c) {obuf[otop++]=c;if(otop==Osize)oclear.clear();}
    inline void puts(const char *s) {while(*s!='\0'){putchar(*s);s++;}putchar('\n');}
    int stk[30],tp;

    inline void read(int &x){
        x =  0 ; int r=0,f=1;char c=getchar();
        while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
        while(isdigit(c))x=x*10+(c^48),c=getchar();
        x *= f ;
    }
    inline void print(int x){
        if(x<0){
            putchar('-');
            x = -x;
        }
        do stk[++tp]=x%10,x/=10;while(x);
        while(tp)putchar(stk[tp--]^48);
    }
}
using superio::read;
using superio::print;
using superio::puts;
using superio::getchar;
using superio::putchar;
bool S_GND ;
const int M = 1100 ;
const int N = 2e5+5 ;
int n,L,ans,mx ;
int a[N],b[N],f[M][M],d[35],pos[35] ;
struct Node{int x,y ;}p[N] ;
set<pii>s ;
void Dfs(int x,int sum1,int sum2)
{
    if(x == n+1) {if(sum1 <= L) ans = max(ans,sum2) ; return ;}
    Dfs(x+1,sum1,sum2),Dfs(x+1,sum1^a[x],sum2^b[x]) ;
}
void Solve1()
{
    Dfs(1,0,0) ;
}
void Solve2()
{
    f[0][0] = 1 ; int up = min(1023ll,mx<<1) ;
    FOR(i,0,up,1) FOR(j,0,up,1) if(i || j) s.insert({i,j}) ; 
    FOR(i,1,n,1)
    {
        vector<pii>k ;
        for(auto [x,y]:s) if(f[x^a[i]][y^b[i]]) f[x][y] = 1,k.pb({x,y}) ;
        for(auto [x,y]:k) s.erase({x,y}) ;
    }
    FOR(i,0,up,1) FOR(j,0,up,1) if(i <= L && f[i][j]) ans = max(ans,j) ;
}
mt19937 rd(19260817) ;
void Insert(Node x)
{
    int val = x.y,pe = x.x ;
    ROF(i,31,0,1) if((val>>i)&1)
    {
        if(d[i]) val ^= d[i] ;
        else {d[i] = val,pos[i] = pe ; return ;}
    }
}
void calc()
{
    me(d,0),me(pos,0) ;
    FOR(i,1,n,1) Insert(p[i]) ;
    int res1 = 0,res2 = 0 ;
    ROF(i,31,0,1) if(d[i] && (res2^d[i]) > res2)
    {
        if((res1^pos[i]) <= L) res2 ^= d[i] ;
        ans = max(ans,res2) ;
    }
    FOR(i,1,n,1) if((res1^p[i].x) <= L)
        res2 = max(res2,res2^p[i].y) ; ans = max(ans,res2) ;

}
int cmp1(Node x,Node y)
{
    return x.x < y.x ;
}
int cmp2(Node x,Node y)
{
    return x.x > y.x ;
}
int cmp3(Node x,Node y)
{
    return x.y < y.y ;
}
int cmp4(Node x,Node y)
{
    return x.y > y.y ;
}
void Solve3()
{
    FOR(i,1,n,1) p[i] = {a[i],b[i]} ;
    sort(p+1,p+1+n,cmp1),calc() ;
    FOR(i,1,40,1)
    {
        if(i%10 == 0) sort(p+1,p+1+n,cmp1) ;
        int x = rd()%n+1,y = rd()%n+1 ;
        if(x > y) swap(x,y) ;
        shuffle(p+x,p+y+1,rd),calc() ;
    }
    sort(p+1,p+1+n,cmp2),calc() ;
    sort(p+1,p+1+n,cmp3),calc() ;
    sort(p+1,p+1+n,cmp4),calc() ;
}
signed main()
{
//cerr<<(double)(&s_gnd-&S_GND)/1024.0/1024.0 ;
	freopen("lock.in","r",stdin) ;
	freopen("lock.out","w",stdout) ;
    read(n),read(L) ;
    FOR(i,1,n,1) read(a[i]),read(b[i]),mx = max({mx,a[i],b[i]}) ;
    if(n <= 18) Solve1() ;
    else if(n <= 1000 && L < 1024) Solve2() ;
    else Solve3() ; 
    print(ans) ;// cerr<<clock()/1000.0 ;
    return 0 ;
}